package com.st.warehouse.ui.navbar;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

import androidx.fragment.app.Fragment;

import com.alibaba.fastjson.JSONObject;
import com.hjy.bluetooth.HBluetooth;
import com.st.warehouse.R;
import com.st.warehouse.ui.activity.GroupActivity;
import com.st.warehouse.ui.activity.TaskPhotoActivity;
import com.st.warehouse.utils.HttpClientUtils;
import com.st.warehouse.utils.LoadingDialog;

public class DiscoverFragment extends Fragment  {
    private static final String TAG = "MyFragment";
    private static DiscoverFragment discoverFragment;
    private View rootView;
    private Button takePhoto;
    private Button chuji,send;

    public DiscoverFragment() {
    }
    //单例创建
    public static DiscoverFragment getInstance(){
        if (discoverFragment == null) return new DiscoverFragment();
        Log.d("test", "onCreateView:DiscoverFragment ");
        return discoverFragment;
    }
    @Override
    public void onDetach() {
        super.onDetach();
        Log.d("MyFragment", "onDetach: DiscoverFragment");
    }
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        if (rootView == null)
            rootView = inflater.inflate(R.layout.fragment_discover, container, false);
        initView();
        listener();
        return rootView;
    }
    private void initView() {
//        TextView title = rootView.findViewById(R.id.title);
//        title.setText("发现");
//        takePhoto = rootView.findViewById(R.id.takePhoto);
//        chuji = rootView.findViewById(R.id.chuji);
//        send = rootView.findViewById(R.id.send);

    }
    private LoadingDialog dialog;//加载弹框
    private Handler mHandler = new Handler();
    private void listener() {



    }

    /**
     * handler处理回调数据
     */
    @SuppressLint("HandlerLeak")
    Handler handler = new Handler() {
        @Override
        public void handleMessage(Message msg) {
            super.handleMessage(msg);
            switch (msg.what) {
                //腾讯逆地址解析
                case HttpClientUtils.MSG_GET_SUCCESS:{
                    JSONObject data = (JSONObject) msg.obj;
                    Log.d(TAG, "data: "+data);
                    break;
                }


            }
        }
    };

    @Override
    public void onDestroy() {
        super.onDestroy();
        Log.d(TAG, "onDestroy: DiscoverFragment");
    }
}